package com.unsafe5;
//结论:不同对象的实例属性不共享
class TicketWindow extends Thread {
    private int ticket = 100;

    @Override
    public void run() {
        while (ticket > 0) {
            System.out.println(getName() + "卖出一张票，票号：" + ticket);
            ticket--;
        }
    }
}

public class SaleTicketDemo02 {
    public static void main(String[] args) {
        TicketWindow w1 = new TicketWindow();
        TicketWindow w2 = new TicketWindow();
        TicketWindow w3 = new TicketWindow();
        w1.setName("窗口1");
        w2.setName("窗口2");
        w3.setName("窗口3");

        w1.start();
        w2.start();
        w3.start();

    }
}
//结果：发现卖出300张票
//问题：不同实例对象的实例变量是独立的